import axios from 'axios'

export const getScenes = (page = 1, limit = 20) => {
	return axios.get('/admin/scenes', { params: { page, limit } })
		.then((response) => Promise.resolve(response.data.result))
}

export const addScene = ({ name, tags, type, url, path, fileName, size } ) => {
	return axios.post('/admin/scene', { name, tags, type, url, path, fileName, size } )
		.then((response) => Promise.resolve(response.data.result))
}

export const updataScene = ({ id, name, tags }) => {
	return axios.put('/admin/scene/' + id, { name, tags })
		.then((response) => Promise.resolve(response.data.result))
}

export const deleteScene = (id) => {
	return axios.delete('/admin/scene/' + id)
		.then((response) => Promise.resolve(response.data.result))
}

export const getScenesByType = (type, page = 1, limit = 20) => {
	return axios.get('/admin/scenes/type/' + type, { params: { page, limit } })
		.then((response) => Promise.resolve(response.data.result))
}
